package com.fly.springbootTemplate.serviceImpl;

import com.fly.springbootTemplate.dao.TeacherDao;
import com.fly.springbootTemplate.entity.Teacher;
import com.fly.springbootTemplate.service.TeacherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;

@Service
public class TeacherServiceImpl implements TeacherService {
    @Autowired
    private TeacherDao teacherDao;

    @Override
    public boolean addTeacher(Teacher teacher) {
        return teacherDao.insertTeacher(teacher);
    }

    @Override
    public boolean deleteTeacher(String teacherId) {
        return teacherDao.deleteTeacher(teacherId);
    }

    @Override
    public boolean updateTeacher(Teacher teacher) {
        return teacherDao.updateTeacher(teacher);
    }

    @Override
    public List<Teacher> getAllTeachers() {
        return teacherDao.selectAllTeacher();
    }

    @Override
    public Teacher getTeacherById(String teacherId) {
        return teacherDao.selectTeacherById(teacherId);
    }

    @Override
    public List<Teacher> getTeacherByName(String teacherName) {
        return teacherDao.selectTeacherByName(teacherName);
    }
}
